package class5;

import common.TreeNode;
import common.TreeNodeUtils;

/**
 * https://leetcode.cn/problems/binary-tree-pruning/
 * 二叉树剪枝
 */
public class Code18_PruneTree {
    public static void main(String[] args) {
        TreeNode treeNode = TreeNodeUtils.getTreeNode();

    }

    public TreeNode pruneTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode l = pruneTree(root.left);
        TreeNode r = pruneTree(root.right);
        if (l == null && r == null && root.val == 0) {
            return null;
        }
        return root;
    }


}
